
#include <iostream>
#include <vector>
#include <string>
#include <random>
#include <chrono>

using namespace std;

// 秋季养生知识数据
const vector<string> autumnKnowledge = {
    "秋季饮食：多吃白色食物如梨、百合、银耳，滋阴润肺",
    "秋季作息：早睡早起，顺应阳气收敛，晚上10点前入睡",
    "秋季运动：选择温和运动如太极拳、散步，避免大汗淋漓",
    "秋季情绪：保持乐观平和，避免秋燥伤肺导致忧郁",
    "秋季穿衣：遵循春捂秋冻原则，早晚加衣，中午减衣",
    "秋季护肤：注意保湿，使用滋润型护肤品防皮肤干燥",
    "秋季饮水：多喝温开水，可加入蜂蜜、枸杞滋阴润燥",
    "秋季养生茶：推荐菊花茶、乌龙茶、普洱茶清火润燥"
};

const vector<string> healthTips = {
    "小贴士：秋季每天吃一个梨，润肺止咳效果好",
    "小贴士：睡前用40℃热水泡脚20分钟，促进血液循环",
    "小贴士：晨起喝一杯温开水，加几滴柠檬汁更佳",
    "小贴士：办公室放置绿植，增加空气湿度缓解秋燥",
    "小贴士：每周吃2-3次银耳莲子汤，滋阴养颜",
    "小贴士：秋季适当吃酸味食物如山楂、柠檬，收敛肺气",
    "小贴士：每天按摩迎香穴（鼻翼两侧）预防感冒",
    "小贴士：秋季多晒太阳，补充维生素D增强抵抗力"
};

// 显示欢迎信息
void showWelcome() {
    cout << "\n========== 秋季养生知识问答 ==========\n";
    cout << "        秋高气爽 养生正当时\n";
    cout << "=====================================\n\n";
}

// 显示主菜单
void showMenu() {
    cout << "请选择功能：\n";
    cout << "1. 查看秋季养生常识\n";
    cout << "2. 随机养生小贴士\n";
    cout << "3. 退出程序\n";
    cout << "请输入选项(1-3): ";
}

// 显示所有养生知识
void showAllKnowledge() {
    cout << "\n========== 秋季养生常识 ==========\n";
    for (size_t i = 0; i < autumnKnowledge.size(); ++i) {
        cout << i + 1 << ". " << autumnKnowledge[i] << "\n";
    }
    cout << "==================================\n\n";
}

// 显示随机小贴士
void showRandomTip() {
    random_device rd;
    mt19937 gen(rd());
    uniform_int_distribution<> dis(0, healthTips.size() - 1);
    
    int index = dis(gen);
    cout << "\n" << healthTips[index] << "\n\n";
}

int main() {
    showWelcome();
    
    int choice;
    bool running = true;
    
    while (running) {
        showMenu();
        cin >> choice;
        
        // 清除输入缓冲区
        cin.ignore(numeric_limits<streamsize>::max(), '\n');
        
        switch (choice) {
            case 1:
                showAllKnowledge();
                break;
            case 2:
                showRandomTip();
                break;
            case 3:
                cout << "感谢使用，祝您秋季健康！\n";
                running = false;
                break;
            default:
                cout << "无效选项，请输入1-3之间的数字。\n";
                break;
        }
    }
    
    return 0;
}
